<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 3.2  (Unix)">
	<META NAME="CREATED" CONTENT="0;0">
	<META NAME="CHANGED" CONTENT="20101230;13583900">
	<STYLE TYPE="text/css">
	<!--
		@page { margin: 0.79in }
		P { margin-bottom: 0.08in }
		PRE { font-family: "Times New Roman" }
	-->
	</STYLE>
</HEAD>
<BODY LANG="el-GR" DIR="LTR">
<PRE LANG="en-US"><FONT SIZE=5><B>decinv</B></FONT>

<FONT SIZE=4><SPAN LANG="en-US">Obtains the inverse of the nxn matrix by partial pivoting,</SPAN></FONT>

<FONT SIZE=4><SPAN LANG="en-US">for details see book of Hang T. Lau, “A Java Numerical Library for Scientists and engineers|”, Chapman &amp; Hall, 2004</SPAN></FONT>

<FONT SIZE=4><SPAN LANG="en-US"><B>Example: Can be run with F5 within the ScalaLab Editor (Ctrl-E to open the editor)</B></SPAN></FONT>



<FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">import numal.*;</SPAN></FONT>

<FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">public class Test_decinv extends Object {</SPAN></FONT>
<FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">	</SPAN></FONT>
<FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">	public static void main(String args[]) {</SPAN></FONT>

  <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">int i;</SPAN></FONT>
  <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">double aux[] = new double[4];</SPAN></FONT>
  <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">double a[][] = new double[5][5];</SPAN></FONT>
  
  <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">a[1][1]=4.0;  a[1][2]=2.0;  a[1][3]=4.0;  a[1][4]=1.0;</SPAN></FONT>
  <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">a[2][1]=30.0; a[2][2]=20.0; a[2][3]=45.0; a[2][4]=12.0;</SPAN></FONT>
  <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">a[3][1]=20.0; a[3][2]=15.0; a[3][3]=36.0; a[3][4]=10.0;</SPAN></FONT>
  <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">a[4][1]=35.0; a[4][2]=28.0; a[4][3]=70.0; a[4][4]=20.0;</SPAN></FONT>
  <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">aux[2]=1.0e-5;</SPAN></FONT>
  <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">Linear_algebra.decinv(a,4,aux);</SPAN></FONT>
  <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">System.out.println(&quot;Calculated inverse:&quot;);</SPAN></FONT>
  <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">for (i=1; i&lt;=4; i++)</SPAN></FONT>
    <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">System.out.println(&quot;\t&quot; + (int)a[i][1] + &quot;\t&quot; + (int)a[i][2] +</SPAN></FONT>
                       <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">&quot;\t&quot; + (int)a[i][3] + &quot;\t&quot; + (int)a[i][4]);</SPAN></FONT>
  <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">System.out.println(&quot;\naux[1] = &quot; + (int)aux[1] + </SPAN></FONT>
                     <FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">&quot;\naux[3] = &quot; + (int)aux[3]);</SPAN></FONT>
<FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">	}</SPAN></FONT>
<FONT SIZE=2 STYLE="font-size: 11pt"><SPAN LANG="en-US">}</SPAN></FONT></PRE>
</BODY>
</HTML>